package cn.kais.drawer.menu;

import java.util.Objects;

/**
 * 组件种类
 * COMPONENT_TEXT = 'TumengText'
 * const COMPONENT_NUMBER = 'TumengNumber'
 * const COMPONENT_MULTI_IMG = 'TumengMultiImg'
 * const COMPONENT_PRICE_TAG = 'TumengPriceTag'
 * const COMPONENT_QRCODE = 'TumengQRCode'
 * const COMPONENT_BAR_CODE = 'TumengBarCode'
 * export const COMPONENT_VIDEO = 'TumengVideo'
 * export const COMPONENT_AD = 'TumengAd'
 * const COMPONENT_WEB_PAGE = 'TumengWebPage'
 * export const COMPONENT_WEATHER = 'TumengWeather'
 * export const COMPONENT_LIVE_BROADCAST = 'TumengLiveBroadcast'
 * const COMPONENT_VALUATION = 'TumengValuation'
 */
public enum MenuBean {

    TEXT("TumengText", "TEXT"), // 文本
    PICTURE("TumengMultiImg", "PICTURE"), // 图片
    CODE_BAR("TumengBARCode", "CODE_BAR"), // 条码
    CODE_QR("TumengQRCode", "CODE_QR"), // 二维码
    NUMBER("TumengNumber", "NUMBER"), // 数值
    TIME("TumengTime", "TIME"), // 时间
    SCORE("TumengValuation", "SCORE"), // 评分
    BLOCK("TumengBlock", "BLOCK"), // 圆形 椭圆形
    LINE("TumengLine", "LINE"), // 线条

    //
    AD("TumengAd", "AD"),  // 广告 需要获取视频封面
    VIDEO("TumengVideo", "VIDEO"), // 视频
    PRICE("TumengPriceTag", "PRICE"),  // 价签  营销模板中的价签模板，需要先生成价签模板图片流，在将流合并到营销模板上
    ;

    public final String code;
    public final String value;


    MenuBean(String code, String value) {
        this.code = code;
        this.value = value;
    }

    public static MenuBean onParseCode(String code) {
        for (MenuBean menu : MenuBean.values()) {
            if (Objects.equals(menu.code, code)) {
                return menu;
            }
        }
        return TEXT;
    }

}
